



typedef struct scalingMatrixSet {

    bool    scalingListPresentFlag;
    UInt32  scalingListSize;
    UInt32* scalingList;

} ScalingMatrix;

typedef struct offsetReferenceFrames {

    UInt32 offsetRefFramesSize;
    UInt32* offsetRefFrames;
} OffsetRefFrames;

typedef struct vuiParametersType {

} vuiParameters;


typedef struct sequenceParameterSet {

    // General profile related.
    UInt8   profileIdc;
    UInt8   constraintFlags;
    UInt8   levelIdc;
    UInt32  SPSId;
    UInt32  chromaIdcFlag;
    bool    seperateColorPlaneFlag;
    UInt32  bitDeapthLumaMinus8;
    UInt32  bitDeapthChromaMinus8;
    bool    qpPrimeYZeroTransformBypassFlag;
    bool    seqScalingMatrixPresentFlag;

    ScalingMatrix*  scalingMatrix;

    UInt32 log2MaxFrameNumMinus4;
    UInt32 picOrserCountType;
    UInt32 log2MaxPicOrderCntLsbMinus4;
    bool   deltaPicOrderAlwaysZeroFlag;
    UInt32 offsetForNonRefPic;
    UInt32 offsetForTopToBottomField;
    UInt32 numRefFramesInPicOrderCntCycle;

    OffsetRefFrames* ReferenceFrameOffset;

    UInt32 maxNumOfReferenceFrames;
    bool   gapsInFrameNumValueAllowedFlag;

    UInt32  pictureWidthInMbMinus1;
    UInt32  pictureHeightInMapUnitsMinus1;

    bool frameMbsOnlyFlag;
    bool mbAdaptiveFrameFeildFlag;
    bool direct8x8InferenceFlag;

    // Frame Cropping related.
    bool frameCroppingFlag;
    UInt32 frameCropLeftOffset;
    UInt32 frameCropRightOffset;
    UInt32 frameCropTopOffset;
    UInt32 frameCropBottomOffset;

    // VUI Parameters.
    bool vuiParametersPresentFlag;
    vuiParameters vuiParams;

} SPSInfo;


typedef struct group {
    UInt32 size;
    void* data;
} DataFroup;

typedef struct pictureParameterSet {

    // SPS PPS Id related.
    UInt32 picParameterSetId;
    UInt32 SequenceParameterSetId;
    bool   entropyCodingModeFlag;
    bool   botomFeildPicOrderInFramePresentFlag;

    // SliceGroup Related.
    UInt32 numOfSliceGroupsMinus1;
    UInt32 sliceGroupMapType;
    DataFroup runLengthMinus1;
    DataFroup topLeft;
    DataFroup bottomRight;
    bool sliceGroupChangeDirectionFlag;
    UInt32 sliceGroupChangeRateMinus1;
    DataFroup sliceFroupId;

    // Reference frame related.
    UInt32 numRefIdxl0DefaultActiveMinus1;
    UInt32 numRefIdxl1DefaultActiveMinus1;
    bool weightedPredectionFlag;
    UInt32 weightedBiPredectionIdc;

    // QP Related.
    UInt32 picInitQPMinus26;
    UInt32 picInitQSMinus26;
    UInt32 chromaQPIndexOffset;
    bool deblockingFilterControlPresentFlag;
    bool constrainedIntraPredectionFlag;
    bool redundantPicCntPresentFlag;

    // Scaling matrix related.
    bool transform8x8ModeFlag;
    bool picScalingMatrixPresentFlag;

    DataFroup pictureScalingListPresentFlag;

    ScalingMatrix*  scalingMatrix;

    UInt32 secondChromaQPIndexFlag;

} PPSInfo;